<?php
class IndexAction extends Action{
   
   /*
    * 资讯首页
    */
   public function index(){
       $this->display(C('MYTEMP').'/index');
    }
    
    /*
     * 资讯搜索页面
     */
    public function soso(){
        $m = M('zixun');
        echo strlen(I('get.q'));
        if(strlen(I('get.q')) < 4) $this->error('搜索的关键词不能少于4个字节');
        $map['title'] = array('like','%'.I('get.q').'%');
        $count = $m->where($map)->count();
        $p = new Page($count,4);
        $soso = $m->field('id,title,pubdate')->where($map)->limit("$p->firstRow,$p->listRows")->select();
        $this->assign('soso',$soso);
        $this->assign('fpage',$p->show());
        $this->display();
    }
    
}